package Service;

import java.io.*;


/**
 * The type Save chat history.
 *
 * @author dzr
 * @version 1.0
 */
public class SaveChatHistory {
    /**
     * Save chat history.
     *
     * @param title             the title
     * @param content           the content
     * @param friendChatHistory the file which save friend's chatHistory
     * @throws IOException the io exception
     */
    public static void saveChatHistory(String title, String content, File friendChatHistory) throws IOException {
        Writer writer = new FileWriter(friendChatHistory, true);
        BufferedWriter bw = new BufferedWriter(writer);

        bw.write(title);
        bw.newLine();
        bw.write(content);
        bw.newLine();
        bw.flush();

        bw.close();
        writer.close();
    }
}
